package WaiBao;

import java.util.Arrays;

public class YangChenLi {
    public static void main(String[] args) {
        String[] name = {"刘大康(班长)", "张正博(纪律委员)", "小李(学习委员)", "张无忌(体育委员)", "张三丰", "灭绝师太", "王福奇", "昆仑山", "峨眉山", "八公山", "李洵", "高建功",
                "高见鸿", "季苍明", "李达康", "郭婷婷", "陈岩石", "李浩男", "天浩楠", "董宇程", "徐宁宇", "李耀宇", "闫想", "闫嘟嘟", "严想", "郭杨恺", "李念念", "王宇",
                "宋正廷", "杨晨丽(学生)"};//考生本人:杨晨丽(学生)
        int[] age = {21, 21, 20, 19, 19, 22, 18, 21, 21, 18, 19, 18, 17, 21, 20, 19, 18, 20, 18, 18, 19, 19, 20, 20, 20, 19, 20, 22, 21, 20};//最后一位：考生年龄:20

        double[] china1 = {81, 72, 87, 81, 76, 68, 74, 89, 80, 70, 74, 87, 85, 76, 74, 78, 61, 91, 92, 84, 72, 91, 75, 88, 71, 74, 82, 64, 61, 79};
        double[] china2 = {64, 71, 88, 84, 84, 78, 74, 74, 73, 81, 83, 78, 87, 75, 85, 64, 71, 74, 76, 68, 82, 64, 65, 80, 70, 86, 76, 50, 74, 80};
        double[] china3 = {74, 73, 78, 85, 78, 69, 70, 81, 84, 69, 63, 81, 85, 75, 68, 68, 69, 69, 66, 73, 92, 81, 90, 65, 79, 84, 79, 67, 60, 82};


        double beijing1;//代表每个学生的总分
        double beijing2;//代表每个学生的平均分
//        for (int i = 0; i < 30; i++) {
//            beijing1 = china1[i] +china2[i] +china3[i];
//            beijing2 = ( beijing1* 1.0) / 3;
//            System.out.println(name[i] + "的总分为:" + beijing1);
//            System.out.println(name[i] + "的平均分为:" +beijing2);
//        }


//        double huoxian1 = 0,huoxian2 = 0;
//        double[] zhihui = new double[30];
//        for (int i = 0; i < 30; i++) {
//            huoxian1 = china1[i] + china2[i] +china3[i];
//            huoxian2 = (huoxian1 * 1.0) / 3;
//            zhihui[i] =huoxian2;
//        }
//
//        for (int i = 0; i <zhihui.length - 1; i++) {
//            for (int j = 0; j < zhihui.length - i - 1; j++) {
//                if (zhihui[j] < zhihui[j + 1]) {
//                    double tep = zhihui[j];
//                    zhihui[j] = zhihui[j + 1];
//                    zhihui[j + 1] = tep;
//                }
//            }
//        }
//        System.out.println("前十名同学的成绩为:");
//        for (int i = 0; i < 10; i++) {
//            System.out.println(zhihui[i]);
//        }

        double linfen1 = 0,linfen2 = 0, linfen3 = 0;//计算每门课的平均分
        double yangquan1 = 0,yangquan2 = 0,yangquan3 = 0;//计算每门课标准差
        double datong1 = 0,datong2 = 0,datong3 = 0;//计算每门课中位数
        double sum2 = 0;
        for (int i = 0; i <china1.length; i++) {
            sum2+=china1[i];
        }
        linfen1 = (sum2*1.0)/30;
        System.out.println("生物化学的班级平均分为:"+linfen1);
        double Sum = 0;
        for (int i = 0; i <china2.length; i++) {
            Sum+=china2[i];
        }
        linfen2 = (Sum*1.0)/30;
        System.out.println("微生物学的班级平均分为:"+linfen2);
        double sum = 0;
        for (int i = 0; i <china3.length; i++) {
            sum+=china3[i];
        }
        linfen3 = (sum*1.0)/30;
        System.out.println("人体组织解剖学的班级平均分为:"+linfen3);



        double c1 = 0,c2 = 0,c3 = 0;
        for (int i = 0; i <china1.length; i++) {
            c1+= (china1[i] -linfen1)*(china1[i] -linfen1);
        }
        yangquan1 = Math.sqrt(c1*1.0/30);
        System.out.println("生物化学的班级标准差为:"+yangquan1);

        for (int i = 0; i < china2.length; i++) {
            c2+= (china2[i] -linfen2)*(china2[i] - linfen2);
        }
        yangquan2 = Math.sqrt(c2*1.0/30);
        System.out.println("微生物学的班级标准差为:"+yangquan2);

        for (int i = 0; i <china3.length; i++) {
            c3+= (china3[i] - linfen3)*(china3[i] - linfen3);
        }
        yangquan3 = Math.sqrt(c3*1.0/30);
        System.out.println("人体组织解剖学的班级标准差为:"+yangquan3);
//////////////////
//////////////////
        Arrays.sort(china1);
        Arrays.sort(china2);
        Arrays.sort(china3);
        datong1 =(china1[14]+china1[15])*1.0/2;
        datong2 =(china2[14]+china2[15])*1.0/2;
        datong3 =(china3[14]+china3[15])*1.0/2;
        System.out.println("生物化学的中位数为:"+datong1);
        System.out.println("微生物学的中位数为:"+datong2);
        System.out.println("人体组织解剖学的中位数为:"+datong3);
//


    }
}
